class LoginModel {
// {
//     "errorCode": 0,
//     "errorMsg": ""
// }

  final LoginInfo? data;
  final num? errorCode;
  final String? errorMsg;

  LoginModel({
    this.data,
    this.errorCode,
    this.errorMsg,
  });

  factory LoginModel.fromJson(Map<String, dynamic> json) {
    return LoginModel(
      data: json['data'] == null ? null : LoginInfo.fromJson(json['data']),
      errorCode: json['errorCode'],
      errorMsg: json['errorMsg'],
    );
  }

  Map<String, dynamic> toJson() => {
        'data': data?.toJson(),
        'errorCode': errorCode,
        'errorMsg': errorMsg,
      };
}

class LoginInfo {
  final bool? admin;
  final List<Object>? chapterTops;
  final int? coinCount;
  final List<Object>? collectIds;
  final String? email;
  final String? icon;
  final int? id;
  final String? nickname;
  final String? password;
  final String? publicName;
  final String? token;
  final int? type;
  final String? username;

  LoginInfo({
    this.admin,
    this.chapterTops,
    this.coinCount,
    this.collectIds,
    this.email,
    this.icon,
    this.id,
    this.nickname,
    this.password,
    this.publicName,
    this.token,
    this.type,
    this.username,
  });

  factory LoginInfo.fromJson(Map<String, dynamic> json) {
    return LoginInfo(
      admin: json['admin'],
      chapterTops:
          json['chapterTops'] == null ? null : List<Object>.from(json['chapterTops'].map((x) => x)),
      coinCount: json['coinCount'],
      collectIds:
          json['collectIds'] == null ? null : List<Object>.from(json['collectIds'].map((x) => x)),
      email: json['email'],
      icon: json['icon'],
      id: json['id'],
      nickname: json['nickname'],
      password: json['password'],
      publicName: json['publicName'],
      token: json['token'],
      type: json['type'],
      username: json['username'],
    );
  }

  Map<String, dynamic> toJson() => {
        'admin': admin,
        'chapterTops': chapterTops?.map((e) => e).toList(),
        'coinCount': coinCount,
        'collectIds': collectIds?.map((e) => e).toList(),
        'email': email,
        'icon': icon,
        'id': id,
        'nickname': nickname,
        'password': password,
        'publicName': publicName,
        'token': token,
        'type': type,
        'username': username,
      };
}
